package com.suarte.core.hibernate;

import com.suarte.core.Guarantee;
import com.suarte.core.dao.GuaranteeDao;
import org.appfuse.dao.hibernate.GenericDaoHibernate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Gcastillo
 * Date: Mar 10, 2011
 * Time: 4:47:10 PM
 * To change this template use File | Settings | File Templates.
 */

@Repository("guaranteeDao")
public class GuaranteeDaoHibernate extends GenericDaoHibernate<Guarantee, Long> implements GuaranteeDao {
    public GuaranteeDaoHibernate() {
        super(Guarantee.class);
    }

    public List<Guarantee> findByDescription(String description) {
        return getHibernateTemplate().find("from Guarantee where description = ?", description);
    }

    public List<Guarantee> findByDays(Integer days) {
        return getHibernateTemplate().find("from Guarantee this where this.days = ?", days);
    }
}
